function agent(v){return (Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function xy(e,v){return (v?(agent('msie')?event.clientY+document.body.scrollTop:e.pageY):(agent('msie')?event.clientX+document.body.scrollTop:e.pageX)); }
function dragDialog(d,e)
{
	function drag(e){if(!stop){ d.style.top=(tX=xy(e,1)+oY-eY+'px'); d.style.left=(tY=xy(e)+oX-eX+'px'); }}
	var oX=parseInt(d.style.left),oY=parseInt(d.style.top),eX=xy(e),eY=xy(e,1),tX,tY,stop;
	document.onmousemove=drag;document.onmouseup=function(){stop=1; document.onmousemove=''; document.onmouseup=''; };
}

function sdopen( type, name, iframe, str )
{
	switch( type )
	{
		case 1:
			w = 800;h = 450;break;
		case 2:
			w = 600;h = 350;break;
		case 3:
			w = 400;h = 230;break;
		case 4:
			w = 300;h = 150;break;
	}
	var x = (document.body.scrollWidth-w)*0.5;
	var y = (document.body.scrollHeight-h)*0.5;
	str = '<div id="dialog_bg" style="background:rgb(51,51,51); position: absolute; left: 0px; top: 0px; opacity: 0.4; width: 100%; height: 100%; z-index: 100;filter:alpha(opacity=40);-moz-opacity: 0.4;"></div><div style="position: absolute; display: block; z-index: 200; left: '+x+'px; top: '+y+'px;width:'+w+'px;" onmousedown="dragDialog(this,event)"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr style="cursor: move;"><td height="33" width="13" style="background-image: url(images/admin/dialog/dialog_lt.png) ! important;"><div style="width: 13px;"></div></td><td height="33" style="background-image: url(images/admin/dialog/dialog_ct.png) ! important;"><div style="padding: 9px 0pt 0pt 4px; float: left; font-weight: bold; color: rgb(255, 255, 255);"><img align="absmiddle" src="images/admin/dialog/icon_dialog.gif"/> '+name+' </div><div onclick="sdclose('+iframe+')"  onmouseout="this.style.backgroundImage=\'url(images/admin/dialog/dialog_closebtn.gif)\'" onmouseover="this.style.backgroundImage=\'url(images/admin/dialog/dialog_closebtn_over.gif)\'" style="margin: 5px 0pt 0pt; position: relative; cursor: pointer; float: right; height: 17px; width: 28px; background-image: url(images/admin/dialog/dialog_closebtn.gif);"></div></td><td height="33" width="13" style="background-image: url(images/admin/dialog/dialog_rt.png) ! important;"><div style="width: 13px;"></div></td></tr><tr><td width="13" style="background-image: url(images/admin/dialog/dialog_mlm.png) ! important;"></td><td align="center" valign="top" style="background:#ffffff;"><div style="overflow: visible;height:'+h+'px;width:'+w+'px" scrolling="auto" >'+str+'</div></td><td width="13" style="background-image: url(images/admin/dialog/dialog_mrm.png) ! important;"/></tr><tr><td height="13" width="13" style="background-image: url(images/admin/dialog/dialog_lb.png) ! important;"/><td style="background-image: url(images/admin/dialog/dialog_cb.png) ! important;"/><td height="13" width="13" style="background-image: url(images/admin/dialog/dialog_rb.png) ! important;"/></tr></tbody></table></div>';
	iframe?parent.$("#dialog").html( str ):$("#dialog").html( str );
}

function sdclose( iframe ){iframe?parent.$("#dialog").html(''):$("#dialog").html('');}

function changePwd()
{
	str = '<iframe name="dialog_main" style="overflow: visible;" scrolling="auto" width="100%" frameborder="0" height="100%" src="home3.htm"></iframe>';
	sdopen( 1, '密码修改', 1, str );
}

function logout()
{
	str = '<div><table height="100%" cellspacing="0" cellpadding="10" border="0" align="center"><tbody><tr><td align="right" width="30%"><img height="34" align="absmiddle" width="34" src="images/admin/icon_query.gif" /></td><td align="left" style="font-size: 9pt;padding-left:30px;" id="Message">你确认要退出系统吗？</td></tr><tr height="36px"><td colspan="2"><div style="border-top: 1px solid rgb(218, 222, 229); padding: 8px 20px; text-align: center; background-color: rgb(246, 246, 246);"><a tabindex="-1" class="slbutton" href="javascript:void(1);" onclick="javascript:window.location=\''+script+'?m=login&a=logout\';"><input type="button" class="srbutton" value="确 定"/></a>&nbsp;&nbsp;&nbsp;&nbsp;<a tabindex="-1" class="slbutton" href="javascript:void(1);"><input type="button" class="srbutton" onclick="sdclose(1)" value="取 消"/></a></div></td></tr></tbody></table></div>';
	sdopen( 4, '退出登录', 1, str );
}
